
<link href="https://magicbox.bkclouds.cc/static_api/v3/assets/bootstrap-3.3.4/css/bootstrap.min.css" rel="stylesheet">
<link href="https://magicbox.bkclouds.cc/static_api/v3/bk/css/bk.css" rel="stylesheet">
<script src="https://magicbox.bkclouds.cc/static_api/v3/assets/js/jquery-1.10.2.min.js"></script>
<script src="https://magicbox.bkclouds.cc/static_api/v3/assets/jquery-tabledit-1.2.3/jquery.tabledit.js"></script>

<table class="table table-bordered" id="example1">
                      <thead>
                          <tr>
                            <th></th>
                             <th>App名称</th>
                             <th>App作者</th>
                             <th>App创建时间</th>
                             <th>App状态</th>
                             <th>访问地址</th>
                             <th>action</th>

                          </tr>
                      </thead>

                       <tbody>
                          % for row in data:

                                  <tr>
                                      <td class="font-family: sans-serif;">${row[0]}</td>
                                      <td class="font-family: sans-serif;">${row[1]}</td>
                                      % if row[4] == '':
                                          <td>bk</td>
                                      % else:
                                          <td>${row[4]}</td>
                                      % endif
                                      <td>${row[5]}</td>
                                      % if row[6] in [0]:
                                          <td style="vertical-align:middle;">
                                                  <label class="label label-default">已下架</label>
                                          </td>
                                      % elif row[6] in [1]:
                                             <td style="vertical-align:middle;">
                                                  <label class="label label-warning">开发中</label>
                                          </td>
                                      % elif row[6] in [3]:
                                          <td style="vertical-align:middle;">
                                              <label class="label label-info">测试中</label>
                                          </td>
                                      % elif row[6] in [4]:
                                           <td style="vertical-align:middle;">
                                              <label class="label label-success">已上线</label>
                                          </td>
                                      % elif row[6] in [8]:
                                          <td style="vertical-align:middle;">
                                              <label class="label label-default">正在提测</label>
                                          </td>
                                      % elif row[6] in [9]:
                                          <td style="vertical-align:middle;">
                                              <label class="label label-default">正在上线</label>
                                          </td>
                                      % elif row[6] in [10]:
                                          <td style="vertical-align:middle;">
                                              <label class="label label-default">正在下架</label>
                                          </td>
                                      % else:
                                          %endif


                                      % if row[6] not in [4]:
                                          <td>
                                            <a style="color:#f92106" href="" title="点击访问">
                                              ${BK_PLAT_HOST}/o/${row[2]}
                                            </a>
                                          </td>
                                          <td>
                                      % else:
                                        <td>
                                          <a target="_blank" style="color:#44b549" href="${BK_PLAT_HOST}/o/${row[2]}" title="点击访问">
                                            ${BK_PLAT_HOST}/o/${row[2]}
                                          </a>
                                        </td>
                                        <td>
                                      % endif

                                      % if row[6] in [4]:
                                              <button class="btn btn-xs btn-success" onclick="window.location.href='${SITE_URL}app_permission/?app_code=${row[2]}&app_name=${row[1]}'">权限配置</button>

                                      % else:
                                                 <button class="btn btn-xs btn-info disabled" >无需操作</button>
                                      % endif
                                          </td>

                                  </tr>

                              % endfor
                          </tbody>
                          <tfoot >
                      <tr>

                  </tr>
          </tfoot>
      </table>
<script type="text/javascript">
    $('#example1').Tabledit({
        url: "${SITE_URL}test/",
        rowKey: 'ops_',
        columns: {
            identifier: [0, 'aid'],
            editable: [
                [1, ''], [2, ''], [3, '']
            ]
        },
        restoreButton: false,
        buttons: {
            edit: {
                class: 'btn btn-sm btn-default',
                html: '<span class="glyphicon glyphicon-pencil"></span>',
                action: 'edit'
            },
            delete: {
                class: 'btn btn-sm btn-default',
                html: '<span class="glyphicon glyphicon-trash"></span>',
                action: 'delete'
            },
            save: {
                class: 'btn btn-sm btn-success',
                html: '保存'
            },
            confirm: {
                class: 'btn btn-sm btn-danger',
                html: '确认'
            }
        },
        onSuccess: function (data, textStatus, jqXHR){
            //console.log('success');
            alert('success')

        },
        onFail: function (jqXHR, textStatus, errorThrown){
            console.log('fail');
        }
    });
</script>
